import 'package:flutter/material.dart';

class CharismaWealth extends StatelessWidget {
  final Map<String, dynamic>? userData; // 存储用户数据的状态变量
  const CharismaWealth({super.key, this.userData});

  @override
  Widget build(BuildContext context) {
    // 确保 userData 不为 null，并提供默认值
    final String useMoneyAll = (userData?['use_money_all'] ?? '0').toString();
    final String earningsAll = (userData?['earnings_all'] ?? '0').toString();

    return Padding(
      padding: const EdgeInsets.fromLTRB(15, 0, 15, 15),
      child: Row(
        children: [
          Text(
            useMoneyAll,
            style: const TextStyle(fontSize: 14),
          ),
          const SizedBox(width: 5),
          const Text(
            '财富值',
            style: TextStyle(fontSize: 10, color: Colors.black54),
          ),
          const SizedBox(width: 20),
          Text(
            earningsAll,
            style: const TextStyle(fontSize: 14),
          ),
          const SizedBox(width: 5),
          const Text(
            '魅力值',
            style: TextStyle(fontSize: 10, color: Colors.black54),
          ),
        ],
      ),
    );
  }
}
